package com.atguigu.mvc.controller.Service;

import com.atguigu.mvc.controller.Dao.DeptDao;
import com.atguigu.mvc.controller.Dao.EmpDao;

import com.atguigu.mvc.entity.Department;
import com.atguigu.mvc.entity.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author : zzf
 * @date : 2021/1/7
 */

@Service
public class EmpService {
    @Autowired
    private DeptDao deptDao;

    @Autowired
    private EmpDao empDao;


    public List<Employee> getEmpList() {
        List<Employee> empList = empDao.getEmpList();
        return empList;
    }

    public void delEmp(String id) {
        empDao.removeEmp(id);
    }

    public void addEmp(Employee employee) {
        empDao.saveEmp(employee);
    }

    public Employee getEmp(String id) {
        Employee emp = empDao.getEmpById(id);
        return emp;
    }

    public void updateEmp(Employee employee) {
        empDao.updateEmp(employee);
    }

    public List<Department> getDeptList() {
        return deptDao.getDeptList();
    }
}
